package test19;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: ws
 * Date: 2023-04-10
 * Time: 21:50
 */
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNextInt()) {
            int n = scanner.nextInt();
            int drinks = 0;
            int bottle = n;
            if (bottle == 0) {
                continue;
            }
            while (bottle > 1) {
                if (bottle == 2) {
                    drinks += 1;
                    bottle = 1;
                    continue;
                }
                drinks += bottle / 3;
                bottle = bottle % 3 + bottle / 3;
            }
            System.out.println(drinks);
        }
    }
}
